package com.atguigu.gulimall.gateway;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;

/**
 * 1.开启服务注册与发现
 *  1) 注解 @EnableDiscoveryClient
 *  2) 配置文件设置(application.properties)
 *      2.1) spring.cloud.nacos.discovery.server-addr=127.0.0.1 :8848
 *      2.2) spring.application.name=gulimall-gateway
 * 2.gateway网关配置
 *  1) 配置文件/resource/bootstrap.properties
 *      1.1) spring.cloud.nacos.config.server-addr=127.0.0.1:8848
 *      1.2) spring.cloud.nacos.config.namespace=7e868bb7-26dd-49e9-a832-3494fb01b675 #7e868bb7-26dd-49e9-a832-3494fb01b675(Nacos股那里中心gulimall-gateway命名空间)
 *  2) route、predicate(断言)、filter 配置
 *      1)参考链接[https://cloud.spring.io/spring-cloud-gateway/2.1.x/single/spring-cloud-gateway.html#_query_route_predicate_factory]
 *      2)新增application.yml配置 [Query Route Predicate Factory]
 * 3)GulimallGatewayApplication 启动报错
 *      1) 原因：gulimall-common依赖有mybatis依赖，但未配置数据源配置信息，故报错。
 *          1.1) pom.xml文件gulimall-common依赖设置白名单排除mybatis依赖
 *
 */
@EnableDiscoveryClient
@SpringBootApplication
public class GulimallGatewayApplication {

    public static void main(String[] args) {
        SpringApplication.run(GulimallGatewayApplication.class, args);
    }

}
